package zut.edu.cn.concertticketmanagementsystem.utils;

import zut.edu.cn.concertticketmanagementsystem.enums.CodeEnum;

/**
 * Created with IntelliJ IDEA.
 * User: heroma
 * Date: 6/22/19
 * Time: 4:43 PM
 * Description: No Description
 */
public class EnumUtil {
    public static <T extends CodeEnum>T getByCode(Integer code, Class<T> enumclass){
        for(T each:enumclass.getEnumConstants()){
            if(code.equals(each.getCode())){
                return each;
            }
        }
        return null;
    }
}

